//
//  Animation.swift
//  one
//
//  Created by huangfeng on 2018/5/3.
//  Copyright © 2018年 huangfeng. All rights reserved.
//

import UIKit

class Animation: NSObject {

    @objc var name: String?
    @objc var age: Int = 0
    @objc var title: String?
    
    class func propertyList() -> [String] {
        
        var count: UInt32 = 0
        
        let list =  class_copyPropertyList(self, &count)
        
        print("animation 属性数量",count)
        
        for i in 0..<Int(count){
            
//            let pty = list?[i]
//
//            let cName = property_getName(pty!)
//
//            let name = String(utf8String: cName)
//            print(name ?? "")
            
            guard let pty = list?[i],
                let cName: UnsafePointer<Int8> = property_getName(pty),
                let name = String(utf8String: cName)
                
            else{
                continue
            }
            
            print(name)
            
        }
        
        // 释放C 语言对象
        free(list)
        
        return []
    }
    
}
